#ifndef __POLL_MODEL_H__
#define __POLL_MODEL_H__





#include "io_model.h"
#include<signal.h>
#include<poll.h>


#define POLL_INIT_SIZE  1024

//poll的上下文;
typedef struct poll_ctx{
	struct pollfd *fds; //要监听的文件描述符集合;
	int nfds; //文件描述符数;
	int timeout; //超时时间;
}POLL_CTX;



//PollMode类;
class PollMode:public ioModel
{
	public:
		PollMode();
		~PollMode();
		int init();
		int addEvent(int fd);
		int addEvent(void *arg);
		int delEvent(void *arg);
		int waitForEvent();
		std::string & getIoName()const;
		void * getIoCtx() { return &ctx; }
	private:
		std::string ioname;
		POLL_CTX ctx;
		MemPool mem;
};



#endif 


